#include "../mqcommon/mq_helper.hpp"

int main()
{
    mq::FileHelper helper("../mqcommon/mq_helper.hpp");
    std::cout << "文件是否存在: " << helper.exists() << std::endl;
    std::cout << "文件大小: " << helper.size() << std::endl;


    mq::FileHelper tmp_helper("./aaa/bbb/ccc/tmp.hpp");
    if (tmp_helper.exists() == false) {
        std::string path = mq::FileHelper::parentDirectory("./aaa/bbb/ccc/tmp.hpp");
        if (mq::FileHelper(path).exists() == false) {
            mq::FileHelper::createDirectory(path);
        }
        mq::FileHelper::createFile("./aaa/bbb/ccc/tmp.hpp");
    }

    std::string body;
    helper.read(body);
    tmp_helper.write(body);

    char buf[10] = {0};
    tmp_helper.read(buf,8,4);
    std::cout << buf << std::endl;

    std::string str = "hello";
    tmp_helper.write(str.c_str(),8,str.size());
    return 0;
}